home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / ultqsrc.zip / HEAD.QC < prev    next >
Text File  |  1996-10-02  |  4KB  |  122 lines

  1. /*
  2.  * Head-related material
  3.  * By AsmodeusB & Mike G
  4.  * It's a solid head which can be gibbed, and moved (by running into it).
  5.  * Also, it falls down if you push it off a cliff. ;)
  6.  */
  7. .float hite;
  8.  
  9. void() HeadPain =
  10. {
  11.  spawn_touchblood (10);
  12. };
  13.  
  14. void() HeadMove = 
  15. {
  16.  local float dir;
  17.  
  18.  
  19.  if(other.takedamage != DAMAGE_AIM)    // not living
  20.    return;
  21.  
  22. if (other.classname == "player")
  23. {
  24. self.angles_x = self.angles_x + other.velocity_y/7;
  25. self.angles_z = self.angles_z + other.velocity_x/7;
  26. if (self.origin_z > other.origin_z && other.velocity_z > 0)
  27.         self.velocity_z = other.velocity_z;
  28. self.alivetime = self.alivetime + (self.alivetime - time);
  29. }
  30.  
  31.  self.velocity_x = other.velocity_x;
  32.  self.velocity_y = other.velocity_y;
  33.  // no z or we can push the corpse into the ground
  34.  
  35. self.velocity = self.velocity + '0 0 7';       // add lift
  36.  
  37. if (self.flags & FL_ONGROUND)
  38.    self.flags = self.flags - FL_ONGROUND;
  39. };
  40.  
  41. void () HeadThink =
  42. {
  43. local float hbob;
  44.         if ((self.watertype == CONTENT_WATER) || (self.watertype == CONTENT_SLIME))
  45.         {
  46.                 self.floating = TRUE;
  47.                 setsize (self, '-8 -8 -12', '8 8 4');        // 24==56
  48.                 self.origin_z = self.origin_z + 4;
  49.                 if (!(self.flags & FL_ONGROUND))
  50.                         self.flags = self.flags + FL_ONGROUND;
  51.                 self.hite = self.origin_z;
  52.         }
  53.         if (self.floating)
  54.         {
  55.                 if (random() > 0.2)
  56.                         self.angles_z = self.angles_z + (random()*6) - 3;
  57.                 if (random() > 0.2)
  58.                         self.angles_x = self.angles_x + (random()*6) - 3;
  59.                 if (random() > 0.2)
  60.                         self.angles_y = self.angles_y + (random()*6) - 3;
  61.                 if (random() > 0.3)
  62.                         {
  63.                         hbob = self.origin_z + (random()*4 - 2);
  64.                         if (hbob > self.hite + 2)
  65.                                 hbob = self.hite + 2;
  66.                         if (hbob < self.hite - 2)
  67.                                 hbob = self.hite - 2;
  68.                         self.origin_z = hbob;
  69.                         }
  70.                 if (random() > 0.5)
  71.                         self.origin_x = self.origin_x + (random () * 4 - 2);
  72.                         self.origin_y = self.origin_y + (random () * 4 - 2);
  73.  
  74.          }
  75. if (self.alivetime < time||self.watertype == CONTENT_LAVA)
  76.         HeadDeath();
  77. self.think = HeadThink;
  78. self.nextthink = time + 0.5;
  79. };
  80.  
  81. /*
  82.  * This uses entity.netname to hold the head file (for CorpseDie())
  83.  * hack so that we don't have to set anything outside this function.
  84.  */
  85.  
  86.  
  87. void(string gibname, float dm, string frommon) ThrowSolidHead =
  88. {
  89.        setmodel (self, gibname);
  90.        self.th_stand = SUB_Null;
  91.        self.th_walk = SUB_Null;
  92.        self.th_run = SUB_Null;
  93.        self.th_melee = SUB_Null;
  94.        self.th_missile = SUB_Null;
  95.        self.th_pain = HeadPain;
  96.        self.frame = 0;
  97.        self.beendead = TRUE;
  98.        self.movetype = MOVETYPE_STEP;          // BOUNCE
  99.        self.takedamage = DAMAGE_AIM;           // NO
  100.        self.solid = SOLID_BBOX;                // NO
  101.        setsize (self, '-8 -8 -12', '8 8 10');        // 24==56
  102.        self.velocity = VelocityForDamage (dm);
  103.        self.flags = self.flags - (self.flags & FL_ONGROUND);
  104.        self.health = 10;
  105.        self.th_die = HeadDeath;
  106.        self.flags = self.flags & (!FL_MONSTER);
  107.        self.angles_z = random()*600;
  108.        self.angles_x = random()*600;
  109.        self.angles_y = random()*600;
  110.        self.classname = "head"; 
  111.        self.frommonname = frommon;
  112.        self.charmed = FALSE;
  113.        self.controller = self;
  114.        self.alive = FALSE;
  115.        self.active = 0;
  116.        self.touch = HeadMove;
  117.        self.onfire = FALSE;
  118.        self.alivetime = time + 25 + (random()*10); // decompose after 30 seconds
  119.        self.think = HeadThink;
  120.        self.nextthink = time + 0.5;
  121. };
  122.